<?php	
	require_once("functions.php"); 
	
	session_start();
	
	// constants
	$topicsPerPage = 5;
	$maxTopicsNum = 100;
	$voteTopicPoints = 2;
	$submitTopicPoints = 10;
	$moderateTopicPoints = 2;
	$statusActive = 1;
	$statusDeleted = 2;

  // local database config
	/*$db_host = "localhost";
	$db_user = "root";
	$db_pass = "patr1ck";
	$db = "ivote";*/
	
	// live database config
	$db_host = "mysql103.mysite4now.com";
	$db_user = "copet80_20463";
	$db_pass = "k4d0m0nai";
	$db = "ivote_20463";
	
  // connect to database
	$link = mysql_connect($db_host, $db_user, $db_pass);
	if (!$link) {
		die("Couldn't connect to MySQL: ".mysql_error());
	}
	mysql_select_db($db, $link)
		or die("Couldn't open $db: ".mysql_error());
	
	if (!isset($_SESSION["categories"])) {
		$qCategories = mysql_query("
			SELECT categoryId
			FROM categories
		");
		$arCategories = array();
		while ($row = mysql_fetch_array($qCategories)) {
			array_push($arCategories, $row["categoryId"]);
		}
		$_SESSION["categories"] = arrayToList($arCategories, ",");
	}
?>